#ifndef FBPROGRESSBAR_H_
#define FBPROGRESSBAR_H_

#include <coecntrl.h>
#include "ConstDefined.hrh"
//#include <coecobs.h>

enum TProgressStyle
{
	EStylePercent = 0,//百分比形式
	EStyleRepeated //重复滚动
};

class CFbProgressBar : public CCoeControl//, public MCoeControlObserver
{
	
public:
	/**
	 * Two-phased constructor.
	 */
	static CFbProgressBar* NewL(CCoeControl& aParent, const TRect &aRect /*,TDesC &aContentTxt = (TDesC)defaultText*/);

	static CFbProgressBar* NewLC(CCoeControl& aParent, const TRect &aRect /*,TDesC &aContentTxt*/);
	void SetProgressBarStyle(const TProgressStyle &aStyle);

	virtual ~CFbProgressBar( );
	
	/**
	 * EPOC default constructor.
	 * @param aRect Frame rectangle for container.
	 */
	void ConstructL(CCoeControl& aParent, const TRect& aRect /*, const TDesC &aContentTxt*/);
	
private: // Functions from base classes

	/**
	* From CoeControl,SizeChanged.
	*/
	void SizeChanged();

	/**
	* From CoeControl,CountComponentControls.
	*/
	TInt CountComponentControls() const;

	/**
	* From CCoeControl,ComponentControl.
	*/
	CCoeControl* ComponentControl(TInt aIndex) const;

	/**
	* From CCoeControl,Draw.
	*/
	void Draw(const TRect& aRect) const;
	
public:
	
	//Set the Width of progressbar
	void SetProgressBarRect(TRect &aRect);
	
	//Set the Color of progressbar
	void SetProgressBarColor(TRgb &aColor);
	
	//Set prompt Text!
	void SetShowTipText(const TDesC &aText,  const TRgb aTextColor = KRgbWhite);
	
	//set prompt text by resid
	void SetShowTipTextL(const TInt aResId,  const TRgb aTextColor = KRgbWhite);
	
	//Set ProgressBar total length
	void SetTotalDataLength(TInt aLen);
	
	//Set ProgressBar Running Step
	void UpdateRunningStep(TInt aRunStep);
	
private:
	//Change the size of Drawrect
	void ChangeDrawRect();
private:
	TProgressStyle m_style;
	
	//Data
	HBufC* iContentText;
	TRgb   iContentTextColor;
	TRect iProgress_Rect, drawRect;
	TRgb iProgressBar_color;
	TInt iTotalLength;
	TInt iRunningSteps;

};

#endif /*FBPROGRESSBAR_H_*/
